Skip to main content

Text

Displays text.

component Text
import { Text } from ui

export var main = Text("Hello, world!")

Constructor

_ text: String

The text to display

color: Color? = nil

The text's color.

info

Inherited from environment, if set to nil. The root environment defines the text color black.

See Color

size: Int? = nil

The text's size in pixels.

info

Inherited from environment, if set to nil. The root environment defines the font size 16.

font_family: FontFamilyName? = nil

The font family.

info

Inherited from environment, if set to nil. The root environment defines the font family Roboto.

See FontFamilyName See load_font

italic: Bool = false

Enables the italic style.

font_weight: Int = font_weights.normal

Font weight.

See font_weights

line_limit: Int? = nil

The maximum number of lines the text can be broken onto.

info

Inherited from environment, if set to nil. The root environment defines the line limit max_integer.

multiline_alignment: HorizontalAlignment? = nil

The alignment of the individual lines when text breaks.

info

Inherited from environment, if set to nil. The root environment defines the multiline alignment center.

See HorizontalAlignment

Layout Behavior

Tries to occupy the exact space needed to display the text. If the horizontal space isn't enough it will try to wrap the lines vertical until everything is displayed or no more space is left. As a last resort, the text is elided to fit into the available space.

Text will never use more space than needed.